// import TooltipText from "@/components/common/tooltipText"
import { ColumnGroupType, ColumnType } from "antd/es/table"

import { IResponseItem } from "@/api/funds/agentTopupReviewRecord/types"
import { timeTurner } from "@/utils"
import { handleNumber } from "@/utils/util"

import OrderStatusTag, { OrderStatus } from "../formItems/funds/orderStatusTag"

const AgentTopupReviewColumn = (
	newFormat: (arg: string) => string,
	getFromDic: (arg: string, strictlyLabel?: boolean) => any,
	renderCopyNo: (arg: string) => any
): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	agentEventId: {
		key: "eventId",
		align: "center",
		dataIndex: "eventId",
		title: newFormat("funds.order_no"),
		render: renderCopyNo,
		width: 270
	},
	agentCreatedAt: {
		key: "createdAt",
		align: "center",
		dataIndex: "createdAt",
		title: newFormat("funds.apply_time"),
		render: text => text || "-",
		width: 180
	},
	agentOperator: {
		key: "operator",
		align: "center",
		dataIndex: "operator",
		title: newFormat("funds.fund_audit.operator"),
		render: text => text || "-",
		width: 120
	},
	agentMerchantNameById: {
		key: "merchantId",
		dataIndex: "merchantId",
		title: newFormat("common.belong_merchant"),
		width: 150,
		align: "center",
		render: getFromDic("merchantList", false)
	},
	agentAdjustType: {
		key: "adjustType",
		align: "center",
		dataIndex: "adjustType",
		title: newFormat("funds.fund_audit.adjust_type"),
		render: getFromDic("proxyPatchAddAdjustType", false),
		width: 150
	},
	agentAdjustAmount: {
		key: "adjustAmount",
		align: "center",
		dataIndex: "adjustAmount",
		title: newFormat("funds.fund_audit.order_amount"),
		render: (text: number, record: IResponseItem) => (
			<span className="order-amount">{(!!text || text === 0) && handleNumber(record.currency, text + "")}</span>
		),
		width: 270
	},
	agentOrderStatus: {
		key: "orderStatus",
		align: "center",
		dataIndex: "orderStatus",
		title: newFormat("funds.fund_audit.order_status"),
		render: (status: OrderStatus) => <OrderStatusTag status={status} />,
		width: 200
	},
	agentAuditTime: {
		key: "audit1Result",
		align: "center",
		dataIndex: "audit1Result",
		title: newFormat("funds.fund_audit.audit_time"),
		render: (_text: string, record: IResponseItem) => {
			return (
				<>
					<p>
						{newFormat("funds.fund_audit.audit_text_1")}：{record.audit1Time || "-"}
					</p>
					{record.audit1Result && (
						<p>
							{newFormat("funds.fund_audit.audit_text_2")}：{record.audit2Time || "-"}
						</p>
					)}
				</>
			)
		},
		width: 220
	},
	agentAuditCost: {
		key: "audit1Cost",
		align: "center",
		dataIndex: "audit1Cost",
		title: newFormat("funds.fund_audit.audit_cost"),
		render: (_text: number, record: IResponseItem) => {
			return (
				<>
					<p>
						{newFormat("funds.fund_audit.audit_text_1")}：{timeTurner(record.audit1Cost) || "-"}
					</p>
					{record.audit1Result === 1 && (
						<p>
							{newFormat("funds.fund_audit.audit_text_2")} ：{timeTurner(record.audit2Cost) || "-"}
						</p>
					)}
				</>
			)
		},
		width: 150
	},
	agentLockAccount: {
		key: "audit1Operator",
		align: "center",
		dataIndex: "audit1Operator",
		title: newFormat("funds.fund_audit.lock_account"),
		render: (_text: string, record: IResponseItem) => {
			return (
				<>
					<p>
						{newFormat("funds.fund_audit.audit_text_1")}：{record.audit1Operator || "-"}
					</p>
					{record.audit1Result === 1 && (
						<p>
							{newFormat("funds.fund_audit.audit_text_2")}：{record.audit2Operator || "-"}
						</p>
					)}
				</>
			)
		},
		width: 180
	}
})

export default AgentTopupReviewColumn
